﻿using FluentNHibernate.Mapping;

namespace OpenWaves.ActivityFeed.NHibernate
{
    public class SubscriberMap: ClassMap<Subscriber>
    {
        public SubscriberMap()
        {
            Id(x => x.Id);
            HasMany(x => x.Subscriptions).Component(part =>
                {
                    part.Map(t => t.Name).Column("Id");
                }).AsSet().Cascade.All().KeyColumn("SubscriberId").ForeignKeyConstraintName("FK_Subscriptions_Subscriber");            
            Not.LazyLoad();
        }
    }
}